from sanic import Sanic
from apps.messages.views import message_bp
from settings import LOGGING_DIC
from apps.base.hunter import CustomErrorHandler

# 注册app并替换logger
app = Sanic("esp32-ai-middleware", log_config=LOGGING_DIC)
# 注册路由
app.blueprint(message_bp)
# 注册错误处理
app.error_handler = CustomErrorHandler()


if __name__ == "__main__":
    # 线上要记得去掉debug
    app.run(host="0.0.0.0", port=8000, workers=4, debug=True)
